package com.caiwangdai.app.backend.api

import com.caiwangdai.app.bean.*
import com.caiwangdai.app.bean.base.BaseB
import com.caiwangdai.app.bean.base.NormalResponseB
import com.caiwangdai.app.bean.base.PageB
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST


interface HomeApi {

    //获取首页信息
    @POST("cashloan/index/Index/indexData")
    fun getHomeContent(): Observable<NormalResponseB<HomeContentB>>


    //实名认证--身份证号码
    @FormUrlEncoded
    @POST("cashloan/authentication/Auth/userAuth")
    fun verifyRealName(@Field("bankcard") bankcard: String?,
                       @Field("name") name: String?,
                       @Field("idcard") idcard: String?): Observable<NormalResponseB<PayOrderB>>

    //商圈签约号
    @FormUrlEncoded
    @POST("cashloan/authentication/Auth/userAuthRes")
    fun postSignInfo(@Field("idcard") idcard: String?,
                     @Field("name") name: String?,
                     @Field("bankcard") bankcard: String?,
                     @Field("no_agree") no_agree: String?): Observable<NormalResponseB<BaseB>>

    //获取借款产品
    @POST("cashloan/loan/Protype/getLoanProduct")
    fun getLoadProduct(): Observable<NormalResponseB<LoanProductPoolB>>

    //申请借款
    @FormUrlEncoded
    @POST("cashloan/loan/Loan/userLoanApplication")
    fun applyForLoan(@Field("product_id") product_id: String?): Observable<NormalResponseB<LoanApplicationB>>


    //还款列表
    @POST("cashloan/loan/Repayment/getUserRepaymentList")
    fun getRepayList(): Observable<PageB<RepaymentB>>


    //还款操作
    @Deprecated("getPayInfo 代替了")
    @FormUrlEncoded
    @POST("cashloan/loan/Repayment/userRepayment")
    fun actionRepay(@Field("order_id") order_id: String): Observable<NormalResponseB<BaseB>>

    //获取还款订单详情
    @FormUrlEncoded
    @POST("cashloan/loan/Repayment/getUserRepaymentInfo")
    fun getUserRepaymentInfo(@Field("order_id") order_id: String): Observable<NormalResponseB<RepayOrderDetailB>>

    //获取android的下载地址
    @POST("cashloan/admin/Common/getAppVersion")
    fun getLatestApk(): Observable<NormalResponseB<LatestApkB>>


    //用户申请还款
    @FormUrlEncoded
    @POST("cashloan/loan/Repayment/userRepaymentByLL")
    fun getPayInfo(@Field("order_id") order_id: String): Observable<NormalResponseB<PayInfoB>>
}